package org.cuatrovientos.empire_fleet;

/**
 * 	Represents a generic space_ship
 * @author Sienar Fleet Systems
 * @greets the emperor
 */
public class SpaceShip {
	private static final int _Cinco = 5;
	private static final int _Cero = 0;
	private static final int _Tres = 3;
	private static final int _Dos = 2;
	private static final int _Uno = 1;
	private int bombs;
	private int type;
	private int speed;
	private int range;
	private int energy;
	protected String pilot_name;
	private int x;
	private int y;
	private int z;
	
	/**
	 * constructor
	 * @param Type
	 */
	public SpaceShip (int Type)  {
		setType(Type);
	}
	
	/**
	 * only for bomber type (==2)
	 * drop a bomb
	 * @return bomb damage
	 */
	public int bomb () {
		if (getType() == _Dos)
			return _Cinco;
		else
			return _Cero;
	}
	
	/**
	 * only tie advanced and bombers
	 * fires ION cannon
	 * @return damage
	 */
	public int fire_ion_cannon () {
		if (getType()==1 || getType()==2) 
			return 3;
		else 
			return 0;
	}
	
	/**
	 * "I'm firing my laser"
	 * @return laser damage depending of type
	 */
	public int fire_laser () {
		int damage = 0;
		switch (getType()) {
			case 0: damage = _Uno;
					break;
			case 1: damage = _Dos;
					break;
			case 2: damage = _Tres;
					break;
			default:damage = _Cero;
					break;
		}
		
		return damage;
	}
	
	/**
	 * move, more or less depending on type
	 * @return positions
	 */
	public int move () {
		int movement = 0;
		switch (getType()) {
			case 0: movement = _Uno;
					break;
			case 1: movement = _Tres;
					break;
			case 2: movement = _Dos;
					break;
			default:movement = _Cero;
					break;
		}
		
		return movement;
	}

	/**
	 * @return the type
	 */
	public int getType() {
		return type;
	}

	/**
	 * @param type the type to set
	 */
	public void setType(int type) {
		this.type = type;
	}
}
